package com.oet.persistence.entity;

// Generated Feb 6, 2010 3:22:38 PM by Hibernate Tools 3.2.4.GA

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 * YdkAccount generated by hbm2java
 */
@Entity
@Table(name = "customer", catalog = "oet")
public class Customer implements java.io.Serializable {

	private Long id;
	private String name;
	private String email;
	private String mobilePhone;
	private String password;
	private Integer level;
	private Date birthday;
	private String thumbnail;
	private String address;
	private String zipCode;
	private Integer couresHours;
	private Boolean isActived;
	
	private Integer totalCourseNumber;
	private Boolean isTestFinished;
	
	private Date lastAccesseDate;
	private Date lastCourseDate;
	private String description;
	
	private Long accountId;
	private Integer age;
	
	private List<UserPlannedCourse> plannedCourses = new ArrayList<UserPlannedCourse>(0);
	private List<UserHistoryCourse> historyCourses = new ArrayList<UserHistoryCourse>(0);
	private List<UserCourseSeries> userCourseSeriess = new ArrayList<UserCourseSeries>(0);
	
	private List<UserComment> userComment = new ArrayList<UserComment>(0);
	

	public Customer() {
	}





	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}



	@Column(name = "name", nullable = false, length = 250)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	

	/**
	 * @return the password
	 */
	@Column(name = "password", length = 80)
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	

	@Column(name = "email", nullable = false, length = 100)
	public String getEmail() {
		return this.email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	
	@Column(name = "is_actived")
	public Boolean getIsActived() {
		return this.isActived;
	}
	public void setIsActived(Boolean isActived) {
		this.isActived = isActived;
	}

	/**
	 * @return the lastAccessed
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_accessed")
	public Date getLastAccesseDate() {
		return lastAccesseDate;
	}
	public void setLastAccesseDate(Date lastAccesseDate) {
		this.lastAccesseDate = lastAccesseDate;
	}

	@Column(name = "mobile_phone", length=50)
	public String getMobilePhone() {
		return mobilePhone;
	}
	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	@Column(name = "thumbnail", length=250)
	public String getThumbnail() {
		return thumbnail;
	}
	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	

	@Column(name = "total_course_number")
	public Integer getTotalCourseNumber() {
		return totalCourseNumber;
	}
	public void setTotalCourseNumber(Integer totalCourseNumber) {
		this.totalCourseNumber = totalCourseNumber;
	}


	


	@Column(name = "description")
	@Lob
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "birthday")
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	
	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}



	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	@JoinTable(
            name="customer_user_planned_course",
            joinColumns = @JoinColumn( name="user_planned_course_pk"),
            inverseJoinColumns = @JoinColumn( name="customer_pk")
    )
    @OrderBy("id desc")
	public List<UserPlannedCourse> getPlannedCourses() {
		return plannedCourses;
	}
	public void setPlannedCourses(List<UserPlannedCourse> plannedCourses) {
		this.plannedCourses = plannedCourses;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	@JoinTable(
            name="customer_user_history_course",
            joinColumns = @JoinColumn( name="user_history_course_pk"),
            inverseJoinColumns = @JoinColumn( name="customer_pk")
    )
    @OrderBy("id desc")
	public List<UserHistoryCourse> getHistoryCourses() {
		return historyCourses;
	}
	public void setHistoryCourses(List<UserHistoryCourse> historyCourses) {
		this.historyCourses = historyCourses;
	}
	
	

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	@JoinTable(
            name="customer_user_comment",
            joinColumns = @JoinColumn( name="user_comment_pk"),
            inverseJoinColumns = @JoinColumn( name="customer_pk")
    )
	public List<UserComment> getUserComment() {
		return userComment;
	}
	public void setUserComment(List<UserComment> userComment) {
		this.userComment = userComment;
	}
	
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	@JoinTable(
            name="customer_user_course_series",
            joinColumns = @JoinColumn( name="user_course_series_pk"),
            inverseJoinColumns = @JoinColumn( name="customer_pk")
    )
    public List<UserCourseSeries> getUserCourseSeriess() {
		return userCourseSeriess;
	}
	public void setUserCourseSeriess(List<UserCourseSeries> userCourseSeriess) {
		this.userCourseSeriess = userCourseSeriess;
	}



	@Column(name = "address")
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}




	@Column(name = "zip_code")
	public String getZipCode() {
		return zipCode;
	}
	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	@Column(name = "coures_hours")
	public Integer getCouresHours() {
		return couresHours;
	}
	public void setCouresHours(Integer couresHours) {
		this.couresHours = couresHours;
	}

	@Column(name = "is_test_finished")
	public Boolean getIsTestFinished() {
		return isTestFinished;
	}
	public void setIsTestFinished(Boolean isTestFinished) {
		this.isTestFinished = isTestFinished;
	}



	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_course_date")
	public Date getLastCourseDate() {
		return lastCourseDate;
	}
	public void setLastCourseDate(Date lastCourseDate) {
		this.lastCourseDate = lastCourseDate;
	}


	@Column(name = "account_id")
	public Long getAccountId() {
		return accountId;
	}
	public void setAccountId(Long accountId) {
		this.accountId = accountId;
	}




	@Column(name = "age")
	public Integer getAge() {
		return age;
	}
	public void setAge(Integer age) {
		this.age = age;
	}
	
	

	
	
	
	
	
	
	
	
	
	
	
	

}
